myApp.factory('$shop', ['$http', function($http){
	var shop = {
		myShop: {"name": "数据还没初始化！"},
		loadShop: function(shopId, allShop) {
			// this.myShop = {"shopId": shopId};
			// var shopData = {"shop.shopId": shopId};

			// var postCfg = {
			// 	headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
			// 	transformRequest: function (data) {
			// 		return $.param(data);
			// 	}
			// };

			// $http.post('searchShopByID', shopData, postCfg).then(function successCallback(response) {
			// 	this.myShop = response.data[0];
			// 	console.log("ok：" + response);
			// }, function errorCallback(response) {
			// 	console.log("fail：" + response);
			// });

			for (var i = 0; i < allShop.length; i++) {
				if(shopId == allShop[i].shopId) {
					this.myShop = allShop[i];
					return;
				}
			}

		}
	}; 
	return shop;
}]);